package com.sheep.dingding.controller;

import com.sheep.dingding.service.DingDingService;
import com.taobao.api.ApiException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author wangze
 * @date 2020-09-21 15:03.
 **/
@RestController
@RequestMapping("/dingding")
public class DingDingController {

	@Resource(name = "ddService")
	private DingDingService dingDingService;

	@GetMapping("/getAccessToken")
	public String getAccessToken() throws ApiException {
		return dingDingService.getAccessToken();
	}
	@GetMapping("/getUserMobile")
	public String getUserMobile(String requestAuthCode) throws ApiException {
		return  dingDingService.getUserMobile(requestAuthCode);
	}

	@GetMapping("/getConfig")
	public Map<String, Object> getConfig(@RequestParam String url) throws ApiException {
		return  dingDingService.getConfig(url);
	}
}
